﻿namespace TomatoBreak.Web
{
    using System;
    using System.Web.Mvc;

    using Castle.Windsor;

    public class WindsorControllerFactory : DefaultControllerFactory
    {
        private readonly IWindsorContainer container;

        public WindsorControllerFactory(IWindsorContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            this.container = container;
        }

        public override void ReleaseController(IController controller)
        {
            container.Release(controller);
        }
    }
}